import torch
###  使用torch 进项张量声明，然后进行加减乘除
x = torch.tensor([1,2,3])
y = torch.tensor([4,5,6])

z = torch.add(x,y)
print(z)

z = torch.subtract(x,y)
print(z)

z = torch.multiply(x,y)
print(z)

z = torch.div(x,y)
print(z)

### 自动微分练习题
import torch

x = torch.tensor([3.0],requires_grad=True)
y = x**2 + 2*x +1
y.backward()
print(x.grad.item())


x  = torch.randn(10)
mode = torch.mode(x)
mode.values.item()
mode.indices.item()


